package com.lx.ngsl.exam.autopaper.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.lx.ngsl.exam.autopaper.entity.PaperEntity;
import com.lx.ngsl.exam.autopaper.service.AutoPaperService;

@RestController
@RequestMapping("/autopaper")
public class AutoPaperController {
	@Autowired
	private AutoPaperService service;
	/*
	 * 试题分页查询
	 */
	@GetMapping("/query")
	public Page<PaperEntity> queryQuestPage(Pageable pageable) {
		return service.paperListPage(pageable);
	}
	//自动组卷
	@GetMapping("/add")
	public boolean addPage(@RequestParam(value = "title", required = true, defaultValue = "") String title) {
		return service.addPage(title);
	}
	//删除试卷（并不是真正的删除，只是将staus置为0）
	@GetMapping("/dele")
	public void delePage(@RequestParam(value = "Id", required = true, defaultValue = "") String Id) {
		 service.delePage(Id);
	}
	// 试卷查询接口
	@GetMapping("/paperquery")
	public Map<String, Object> queryPage(@RequestParam(value = "Id", required = true, defaultValue = "") String Id) {
		 return service.appQueryPage();
	}
}
